package ${package_controller};

import ${package_query}.${Table}Query;
import ${package_dto}.${Table}Dto;
import ${package_service}.${Table}Service;
import com.iot.commons.ResponseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * ${TableRemarks}
 * @author: ${author}
 * @date: ${date}
 */
@RestController
@RequestMapping("/${table}")
@RequiredArgsConstructor
public class ${Table}Controller {

    private final ${Table}Service ${table}Service;

    /**
     * ${TableRemarks}分页条件搜索实现
     * @param ${table}
     * @return resultList
     */
    @PostMapping(value = "/getList")
    public ResponseResult getList(@RequestBody ${Table}Query ${table}) {
        return  ${table}Service.getList(${table});
    }

    /**
     * ${TableRemarks}修改
     * @param ${table}
     * @return
     */
    @PostMapping(value = "/edit")
    public ResponseResult edit(@RequestBody ${Table}Dto ${table}) {
        return ${table}Service.edit(${table});
    }

    /**
     * ${TableRemarks}新增
     * @param ${table}
     * @return
     */
    @PostMapping(value = "/add")
    public ResponseResult add(@RequestBody ${Table}Dto ${table}) {
        return ${table}Service.add(${table});
    }

    /**
     * ${TableRemarks}详情
     * @param ${table}
     * @return
     */
    @PostMapping(value = "/getById")
    public ResponseResult getById(@RequestBody ${Table}Query ${table}) {
        return ${table}Service.getById(${table});
    }
}
